package com.keya.features.tool;

import org.dcm4che3.data.UID;
import org.dcm4che3.net.pdu.CommonExtendedNegotiation;
import org.dcm4che3.util.StringUtils;

import java.util.HashMap;
import java.util.Properties;

/**
 * StoreSCU 工具类
 *
 * @author : xf.he
 * @version : 1.0 2023/11/2
 * @since : 1.0
 **/
class RelatedGeneralSOPClasses {

    private final HashMap<String, CommonExtendedNegotiation> commonExtNegs = new HashMap<>();

    public void init(Properties props) {
        for (String cuid : props.stringPropertyNames())
            commonExtNegs.put(cuid, new CommonExtendedNegotiation(cuid, UID.Storage, StringUtils.split(props.getProperty(cuid), ',')));
    }

    public CommonExtendedNegotiation getCommonExtendedNegotiation(String cuid) {
        CommonExtendedNegotiation commonExtNeg = commonExtNegs.get(cuid);
        return commonExtNeg != null ? commonExtNeg : new CommonExtendedNegotiation(cuid, UID.Storage);
    }
}
